const Mock = require('mockjs');
const utils = require('../utils');

const { Random } = Mock;

function getNotices(req) {
  const result = [];
  for (let i = 0, len = Random.integer(0, 20); i < len; i += 1) {
    result.push({
      key: Random.guid(),
      text: `${req.query.startDate}：${Random.cparagraph(2, 5)}`,
    });
  }
  return Mock.mock(utils.setSuccessRes(result, result.length));
}

function getWarns(req) {
  const result = [];
  for (let i = 0, len = Random.integer(0, 20); i < len; i += 1) {
    result.push({
      key: Random.guid(),
      text: `${req.query.startDate}：${Random.cparagraph(2, 5)}`,
    });
  }
  return Mock.mock(utils.setSuccessRes(result, result.length));
}

module.exports = {
  getNotices,
  getWarns,
};
